var crypto = require('crypto');
var cache = require('memory-cache');
var captchapng = require('captchapng');
var restModule = {};

restModule.process = function(req, res, next) {
  switch (req.method) {
    case 'POST':
      return this.processPost(req, res, next);
    case 'GET':
      return this.processGet(req, res, next);
    case 'PUT':
      return this.processPut(req, res, next);
    case 'DELETE':
      return this.processDelete(req, res, next);
  }
}

restModule.processGet = function(req, res, next) {
  var restReq = req.frontierReq;
  var restRes;
    restRes = {
      "status": "SUCCESS",
      "result": null
    }

  res.restRes = restRes;
  next();
}

restModule.processPost = function(req, res, next) {
  var restReq = req.frontierReq;

    restRes = {
      "status": "SUCCESS",
      "userStatus": null,
      "callId": 12927373,
      "message": null,
      "result": {
          "type": 1,
          "operatorName": "operator123",
          "sessionId": "123",
          "servManCode": "11232341",
          "servManName": "admin"
      }
    }

  res.restRes = restRes;
  next();
}

restModule.processPut = function(req, res, next) {
  var restReq = req.frontierReq;
  var restRes = {
    "status": "SUCCESS",
    "result": {}
  }
  res.restRes = restRes;
  next();
}

restModule.processDelete = function(req, res, next) {
  var restReq = req.frontierReq;
  var restRes = {
    "status": "SUCCESS",
    "result": {}
  }
  res.restRes = restRes;
  next();
}

module.exports = restModule;